<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions" >
<h:head>
	<title>List Employees</title>
</h:head>
<h:body>
	<h:link value="PERSONAL HOME" outcome="index" />
 	<h:form id="form">
        <p:dataTable id="dataTableEmployee" var="employee" value="#{listEmployees.employees}"  
                 paginator="true" rows="15" rowKey="#{employee.id}" dblClickSelect="false"
                 selectionMode="single" selection="#{listEmployees.selectedEmployee}"
                 paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink}
                 {PageLinks} {NextPageLink} {LastPageLink}" >
        
     	<f:event type="preRenderView" listener="#{listEmployees.init()}" />
     	
        <p:ajax event="rowSelect" listener="#{listEmployees.onRowSelectNavigate}" />
        
        <f:facet name="header">  
            List employees
        </f:facet>  
  
        <p:column sortBy="email" headerText="Email">  
            <h:outputText value="#{employee.email}" />  
        </p:column>  
  
        <p:column sortBy="name" headerText="Name">
            <h:outputText value="#{employee.name}" />  
        </p:column>  
  
        <p:column sortBy="surname" headerText="Surname">
            <h:outputText value="#{employee.surname}" />  
        </p:column>
        
        <f:facet name="footer">  
              Total employees: #{listEmployees.employees.size()}
        </f:facet>
    	</p:dataTable>
	</h:form>
</h:body>
</html>